<template>
	<view>
		<cu-custom bgColor="bg-white" :isBack="true">		<block slot="backText"></block>
			<block slot="content">{{title}}</block>
		</cu-custom>
		
		<view class="whole-box">
		<!-- <view class="whole-box" style="background-color: #FB7483;"> -->
			<view class="gold-black-box">
				
				<view class="top-box" :style="'height:'+scroll_box_height+'px'" v-if="list">
					<view class="top-box-content" >
						
						<view class="data-box">
							<text>会员id:<text>{{list.member_id}}</text></text>
						</view>
						<view class="data-box2">
							<text>代销商品:<text>{{list.product.title}}</text></text>
						</view>
						<view class="data-box2">
							<text>购买份数:<text>{{list.num}}</text></text>
						</view>
						<view class="data-box2">
							<text>购买单价:<text>{{list.product.wholesale_price}}</text></text>
						</view>
						<view>
							<rich-text :nodes="list.intro"></rich-text>
						</view>
						<view class="data-box2">
							<text >时间：{{$common.timeFormat(list.created_at)}}</text>
						</view>
					</view>
					
				</view>
				
			</view>
		</view>		
		
	
		<Navbar ref="navbar" PageCur="order"></Navbar>
	</view>
</template>

<script>
	import cmdProgress from "@/components/cmd-progress/cmd-progress.vue"
	import Navbar from '@/components/default/Navbar.vue'
	// import Foot from '@/components/default/foot.vue'
	import {
		mapState
	} from 'vuex'
	export default {
		// name: "order",
		components: {
			cmdProgress,
			Navbar
		},
		computed: mapState(['forcedLogin', 'hasLogin', 'channelLogin']),
		mounted() {
			// this.getScrollH()
		},
		data() {
			return {
				theme: this.$config.THEME(),
				list: null,
				title: '认购详情',
				member: [],
				total: 0,
				scroll_box_height: 900,
				scrollHeight: 900,
				hasMore:true,
				loading:false,
				page:1,
				id:0,
			};
		},
		onLoad(options) {
			this.id=options.orderid
			if (this.$common.loginAuth(true)) {
				this.$common.getMember().then((member)=>{
					this.member = member
					
				})
				this.$nextTick(function() {
					this.getShowdata();
					uni.startPullDownRefresh({})
					// this.getScrollH()
					
				})
			}
		},
		onShow() {
			if (this.$common.loginAuth(true)) {
				if (this.$common.getCache('order_reload')) {
					this.$common.rmCache('order_reload')
					this.$nextTick(function() {
						uni.startPullDownRefresh({})
					})
				}
			}
		},
		methods: {
		
			getShowdata(){
			
				this.$http
					.get('sell_order_view', {id:this.id})
					.then((response) => {
						// console.log(response)
						this.list = response.data.data
						this.list.intro = this.$common.mathRichText(response.data.data.config.protocol_dianzi)
						console.log(this.list)
						uni.stopPullDownRefresh()
					})
					.catch((response) => {
						console.log(response)
					})
			},
			reloadList() {
				uni.startPullDownRefresh({})
			},
			getMore() {
				// this.getList()
			},
		},
		onPullDownRefresh() {
			
			// this.list = []
			// this.hasMore = true
			// this.page = 1
			// this.loading = false
			// this.getList()
			
		},
		onReachBottom() {
			// this.getList()
		},
	}
</script>

<style>
	.thumb {
		width: 160rpx;
		height: 160rpx;
		min-width: 160rpx;
		border-radius: 10rpx;
		overflow: hidden;
	}

	.thumb image {
		width: 100%;
		height: 100%;
		
	}

	.product-name {
		/* height: 80rpx; */
		line-height: 40rpx;
		overflow: hidden;
	}
</style>
<style>
	.cu-active{
		/* background: -webkit-linear-gradient(left, #FFEA5E, #FFEA5E, #FCC710, #FCC710); */
		/* background-color: #815ad7; */
		background-color: rgb(254,39,114);
		color: #ffffff;
		border-radius: 20px;
	}
	.nav .cu-item{
		height: 25px!important;
		line-height: 25px!important;
		text-align: center;
		/* float: left; */
		/* width: 12%; */
	}
	.whole-box{
		/* background-color: #333333; */
		min-height: calc(100vh - 45px);
		padding: 12px 0;
		background-image: url(../../../static/red-new/new-back.png);
		background-size: 100% 100%;
	}
	.gold-black-box{
		padding: 12px 0;
		margin: 0 10rpx;
		/* border: 2rpx solid #999999; */
		border-radius: 30rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	
	.gold-black-box .top-box{
		/* margin-top: 25rpx; */
		width: 690rpx;
		height: 300rpx;
		/* border: 2rpx solid #999999; */
		border-radius: 15rpx;
		overflow: hidden;
		position: relative;
		background-color: #ffffff;
	}
	.top-box .top-box-bg{
		width: 100%;
		height: 100%;
	}
	.top-box .top-box-content{
		width: 690rpx;
		/* height: 276rpx; */
		position: absolute;
		left: 0;
		top: 0;
		display: flex;
		flex-direction: column;
		align-items: center;
	}
	.top-box-content .avatar{
		margin-top: 26rpx;
		width: 150rpx;
		height: 150rpx;
		border-radius: 50%;
		border: 1rpx solid #EAEAEA;
	}
	.top-box-content .username{
		margin-top: 14rpx;
		font-size: 28rpx;
		font-weight: bold;
		color: #000000;
	}
	.top-box-content .bg-logo{
		width: 196rpx;
		height: 54rpx;
		padding-left: 20rpx;
	}
	.top-box-content .page-title{
		padding-left: 40rpx;
		font-size: 36rpx;
		font-weight: bold;
		color: #000000;
	}
	
	.top-box-content .data-box{
		padding: 0 40rpx;
		width: 100%;
		display: flex;
		/* justify-content: space-around; */
/* 		align-items: center;
		text-align: center; */
		margin-top: 12px;
	}
	.data-box view{
		width: 50%;
		font-size: 28rpx;
		font-weight: bold;
		color: #000000;
	}
	.data-box view text{
		margin-left: 10rpx;
	}
	.top-box-content .data-box2{
		padding: 0 40rpx;
		width: 100%;
		display: flex;
		/* justify-content: space-around;
		align-items: center;
		text-align: center; */
		margin: 8px 0px;
	}
	.data-box2 view{
		width: 50%;
		font-size: 28rpx;
		font-weight: bold;
		color: #000000;
	}
	.data-box2 view text{
		margin-left: 10rpx;
	}
	
	.top-box .level-detail{
		position: absolute;
		top: 52rpx;
		left: 400rpx;
		padding: 0 20rpx;
		height: 40rpx;
		line-height: 40rpx;
		border-radius: 20rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		/* background-color: #000000; */
		/* background: -webkit-linear-gradient(left, #C48415, #C48415, #EDCB3E, #CA8B0F); */
		/* background: -webkit-gradient(linear, 0 0, 0 100%, from(#C48415), to(#CA8B0F)); */
	}
	.level-detail image{
		width: 145rpx;
		height: 43rpx;
		margin-right: 6rpx;
		flex-shrink: 0;
		left: -13px;
		/* top: 16px; */
	}
	.level-detail text{
		font-size: 22rpx;
		font-weight: bold;
		color: #ffffff;
		position: absolute;
		margin-top: 10rpx;
		margin-left: -15rpx;
	}
	
	
</style>

<style>
	.gold-black-box .my-data-box{
		margin-top: 12px;
		width: 764rpx;
		height: 336rpx;
		/* border: 2rpx solid #999999; */
		border-radius: 30rpx;
		overflow: hidden;
		position: relative;
	}
	.my-data-box .my-data-box-bg{
		width: 100%;
		height: 100%;
	}
	.my-data-box .my-data-box-content{
		width: 100%;
		/* height: 336rpx; */
		position: absolute;
		left: 0;
		top: 0;
		
		/* display: flex;
		justify-content: space-between;
		align-items: center; */
		padding: 0 40rpx;
	}
	
	.my-data-box-content .scroll-list{
		
	}
	.scroll-list .my-status{
		color: #E5D4B9
	}
	
	.my-data-box-content .order-box{
		
	}
	.order-box{
		
	}
</style>
<style>
	.order-item{
		/* border: 1rpx solid #999999; */
		border-radius: 20rpx;
		margin-top: 20rpx;
		width: 690rpx;
		height: 480rpx;
		overflow: hidden;
		position: relative;
		background: #ffffff;
	}
	/* .order-item .my-data-box-bg{
		width: 100%;
		height: 100%;
	}
	
	.order-item .my-data-box-content{
		width: 610rpx;
		height: 480rpx;
		position: absolute;
		left: 0;
		top: 0;
		padding: 20rpx;
	} */
</style>